/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.crossriver.crgis.database.service.http;

import com.crossriver.crgis.database.model.Individual_Information;

import com.liferay.portal.kernel.json.JSONArray;
import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.util.StringPool;

import java.util.Date;
import java.util.List;

/**
 * @author    Wole Adetiba
 * @generated
 */
public class Individual_InformationJSONSerializer {
	public static JSONObject toJSONObject(Individual_Information model) {
		JSONObject jsonObj = JSONFactoryUtil.createJSONObject();

		jsonObj.put("applicationId", model.getApplicationId());
		jsonObj.put("userId", model.getUserId());
		jsonObj.put("title", model.getTitle());
		jsonObj.put("lastName", model.getLastName());
		jsonObj.put("firstName", model.getFirstName());
		jsonObj.put("middleName", model.getMiddleName());

		Date dateOfBirth = model.getDateOfBirth();

		String dateOfBirthJSON = StringPool.BLANK;

		if (dateOfBirth != null) {
			dateOfBirthJSON = String.valueOf(dateOfBirth.getTime());
		}

		jsonObj.put("dateOfBirth", dateOfBirthJSON);
		jsonObj.put("occupation", model.getOccupation());
		jsonObj.put("gender", model.getGender());
		jsonObj.put("religion", model.getReligion());
		jsonObj.put("education", model.getEducation());
		jsonObj.put("nationality", model.getNationality());
		jsonObj.put("stateOfOrigin", model.getStateOfOrigin());
		jsonObj.put("lga", model.getLga());
		jsonObj.put("maritalStatus", model.getMaritalStatus());
		jsonObj.put("noOfChildren", model.getNoOfChildren());
		jsonObj.put("identificationDoc", model.getIdentificationDoc());
		jsonObj.put("identificationDocNo", model.getIdentificationDocNo());

		return jsonObj;
	}

	public static JSONArray toJSONArray(
		com.crossriver.crgis.database.model.Individual_Information[] models) {
		JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

		for (Individual_Information model : models) {
			jsonArray.put(toJSONObject(model));
		}

		return jsonArray;
	}

	public static JSONArray toJSONArray(
		com.crossriver.crgis.database.model.Individual_Information[][] models) {
		JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

		for (Individual_Information[] model : models) {
			jsonArray.put(toJSONArray(model));
		}

		return jsonArray;
	}

	public static JSONArray toJSONArray(
		List<com.crossriver.crgis.database.model.Individual_Information> models) {
		JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

		for (Individual_Information model : models) {
			jsonArray.put(toJSONObject(model));
		}

		return jsonArray;
	}
}